Presentation Style
カスタムしたい場合
https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/DefiningCustomPresentations.html#//apple_ref/doc/uid/TP40007457-CH25-SW1
概要
UIViewController の Presentation Style とは、Presented View Controller としての外観 を決めるスタイルのこと。
表示したい ViewController の modalPresentationStyle に適切な定数を割り当てる。この値であるUIModalPresentationStyle は enum で、いくつかの style が定義されている。
The Full-Screen Presentation Style
画面全体を占有する方式。裏側の view が透けて見える場合は、調光や透過などが行われる。水平方向が compact な場合は全て fullScreen となるが、regular の場合は適切な方式で表現される。
fullScreen 画面全体を新規 view で覆う方式。水平方向が compact の場合は自動的にこれになる
pageSheet 新規 view の両脇が削れている方式。
formSheet 新規 view が画面中央に四角形として描画される方式
overFullScreen 裏の view 群を削除しない fullScreen 方式。presented view controller に透過箇所がある場合に有用
blurOverFullScreen 裏の view 群を削除せず、さらに blur をかける fullScreen 方式
The Popover Style
popover view 内に情報を描画する方式。選択/着目したオブジェクトに関連するアイテムのリストや追加の情報を表現するのに適している。水平方向が regular な環境の場合はスクリーンの一部のみ占有する。compact な環境では overFullScreen 方式での描画がデフォルトとなる。範囲外をタップした場合、popover は自動的に消えるが、これは水平方向が regular な環境でのみ使える。ので、compact な環境でのみ、ユーザに画面を消す方法を提供する必要がある。
popover
Presenting a View Controller in a Popover
The Current Context Styles
特定の ViewController を覆う形式。あらかじめ、覆う対象の ViewController の definesPresentationContext を true に設定しておく必要がある。
このスタイルの描画の発生時、UIKit はpresenting view controller からview hierarchy を遡り、該当プロパティが true のものを発見したら、新しい ViewController の描画の指示を出す。見つからなかった場合は rootViewController に描画を指示する。
currentContext 裏の view 群を削除する
overCurrentContext 裏の view 群を削除しない。presented view controller に透過箇所がある場合に有用
https://developer.apple.com/documentation/uikit/uiviewcontroller/1621456-definespresentationcontext
Custom Presentation Styles
ユーザ定義のカスタムスタイル。カスタムスタイルの定義のためには UIPresentationController をサブクラス化する。
custom
Creating Custom Presentations
参考
View Controller Programming Guide for iOS - Presenting a View Controller